package xyz.scootaloo.oj.leetcode

import org.junit.Test
import xyz.scootaloo.console.app.support.Tester

/**
 * @author flutterdash@qq.com
 * @since 2021/4/20 10:28
 */
class P674 {

    fun findLengthOfLCIS(nums: IntArray): Int {
        if (nums.isEmpty())
            return 0
        var max = 1
        var current = 1
        for (idx in 1 until nums.size) {
            if (nums[idx] > nums[idx - 1]) {
                current++
            } else {
                if (current > max) {
                    max = current
                }
                current = 1
            }
        }

        if (current > max) {
            max = current
        }
        return max
    }

    @Test
    fun test0() {
        Tester.createTest(this::findLengthOfLCIS)
            .addCase(intArrayOf(1, 3, 4, 4, 7), 3)
            .addCase(intArrayOf(2, 2, 2, 2, 2, 2), 1)
            .testAndShow()
    }

}
